package com.lightjet.macross.base.awf.config;

import org.activiti.engine.delegate.event.ActivitiEventListener;
import org.activiti.spring.SpringProcessEngineConfiguration;
import org.activiti.spring.boot.ProcessEngineConfigurationConfigurer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

/**
 * @author : lijia
 * @version : 1.0 2019-02-19 17:23
 * description :
 */

@Component
public class ActivitiConfig implements ProcessEngineConfigurationConfigurer {

    @Autowired
    private ComActivitiEventListener comActivitiEventListener;

    @Autowired
    private ICustomProcessDiagramGenerator customProcessDiagramGenerator;

    @Override
    public void configure(SpringProcessEngineConfiguration processEngineConfiguration) {
        List<ActivitiEventListener> activitiEventListener=new ArrayList<ActivitiEventListener>();
        activitiEventListener.add(comActivitiEventListener );//配置全局监听器
        processEngineConfiguration.setEventListeners(activitiEventListener);
        processEngineConfiguration.setProcessDiagramGenerator(customProcessDiagramGenerator);
    }
}
